/*******************************************************************************
**
** Copyright (c) 2011 - The OWE Team
**
** This file is part of OWE.
**
** OWE is a free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; version
** version 2.1 of the License.
**
** OWE is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with OWE. If not, see <http://www.gnu.org/licenses/>.
**
*******************************************************************************/

#ifndef CONFIGPARSER_H
#define CONFIGPARSER_H

#include <owe/global.h>

OWE_BEGIN_NAMESPACE

class ConfigParserPrivate;
class UString;
class WidgetElement;

/*!
    \class ConfigParser
    \brief Configuration document parser.

    \ingroup Configuration

    This class hides parsing of configuration document (config.xml), implemented
    by a specific backend.
*/
class OWE_EXPORT ConfigParser
{
public:
    /*!
        Constructs a ConfigParser for a given configuration document \a path.
        An absolute file path must be used.
     */
    ConfigParser(const UString &path);

    /*!
        Destructs the object releasing all allocated resources.
     */
    ~ConfigParser();

    /*!
        Returns whether a ConfigParser instance is valid. An invalid parser
        instance might be caused by malformed or inexistent config.xml file.
     */
    bool isValid() const;

    /*!
        Returns a WidgetElement object, which is the root of the configuration
        file.
     */
    const WidgetElement *widgetElement() const;

private:
    ConfigParserPrivate *d_ptr;
};

OWE_END_NAMESPACE

#endif // CONFIGPARSER_H
